home *** CD-ROM | disk | FTP | other *** search
/ Cream of the Crop 25 / Cream of the Crop 25.iso / doom / quake_ad.zip / HIPQW.ZIP / SRC / PLAYER.QC < prev    next >
Text File  |  1997-03-13  |  24KB  |  833 lines

  1.  
  2. void() bubble_bob;
  3.  
  4. /*
  5. ==============================================================================
  6.  
  7. PLAYER
  8.  
  9. ==============================================================================
  10. */
  11.  
  12. $cd /raid/quake/id1/models/player_4
  13. $origin 0 -6 24
  14. $base base        
  15. $skin skin
  16.  
  17. //
  18. // running
  19. //
  20. $frame axrun1 axrun2 axrun3 axrun4 axrun5 axrun6
  21.  
  22. $frame rockrun1 rockrun2 rockrun3 rockrun4 rockrun5 rockrun6
  23.  
  24. //
  25. // standing
  26. //
  27. $frame stand1 stand2 stand3 stand4 stand5
  28.  
  29. $frame axstnd1 axstnd2 axstnd3 axstnd4 axstnd5 axstnd6
  30. $frame axstnd7 axstnd8 axstnd9 axstnd10 axstnd11 axstnd12
  31.  
  32.  
  33. //
  34. // pain
  35. //
  36. $frame axpain1 axpain2 axpain3 axpain4 axpain5 axpain6
  37.  
  38. $frame pain1 pain2 pain3 pain4 pain5 pain6
  39.  
  40.  
  41. //
  42. // death
  43. //
  44.  
  45. $frame axdeth1 axdeth2 axdeth3 axdeth4 axdeth5 axdeth6
  46. $frame axdeth7 axdeth8 axdeth9
  47.  
  48. $frame deatha1 deatha2 deatha3 deatha4 deatha5 deatha6 deatha7 deatha8
  49. $frame deatha9 deatha10 deatha11
  50.  
  51. $frame deathb1 deathb2 deathb3 deathb4 deathb5 deathb6 deathb7 deathb8
  52. $frame deathb9
  53.  
  54. $frame deathc1 deathc2 deathc3 deathc4 deathc5 deathc6 deathc7 deathc8
  55. $frame deathc9 deathc10 deathc11 deathc12 deathc13 deathc14 deathc15
  56.  
  57. $frame deathd1 deathd2 deathd3 deathd4 deathd5 deathd6 deathd7
  58. $frame deathd8 deathd9
  59.  
  60. $frame deathe1 deathe2 deathe3 deathe4 deathe5 deathe6 deathe7
  61. $frame deathe8 deathe9
  62.  
  63. //
  64. // attacks
  65. //
  66. $frame nailatt1 nailatt2
  67.  
  68. $frame light1 light2
  69.  
  70. $frame rockatt1 rockatt2 rockatt3 rockatt4 rockatt5 rockatt6
  71.  
  72. $frame shotatt1 shotatt2 shotatt3 shotatt4 shotatt5 shotatt6
  73.  
  74. $frame axatt1 axatt2 axatt3 axatt4 axatt5 axatt6
  75.  
  76. $frame axattb1 axattb2 axattb3 axattb4 axattb5 axattb6
  77.  
  78. $frame axattc1 axattc2 axattc3 axattc4 axattc5 axattc6
  79.  
  80. $frame axattd1 axattd2 axattd3 axattd4 axattd5 axattd6
  81.  
  82.  
  83. /*
  84. ==============================================================================
  85. PLAYER
  86. ==============================================================================
  87. */
  88.  
  89. void() player_run;
  90.  
  91. void()    player_stand1 =[    $axstnd1,    player_stand1    ]
  92. {
  93.     self.weaponframe=0;
  94.     if (self.velocity_x || self.velocity_y)
  95.     {
  96.         self.walkframe=0;
  97.         player_run();
  98.         return;
  99.     }
  100.  
  101.     if (self.weapon == IT_AXE)
  102.     {
  103.         if (self.walkframe >= 12)
  104.             self.walkframe = 0;
  105.         self.frame = $axstnd1 + self.walkframe;
  106.     }
  107. //hip
  108.    else if (self.weapon == IT_MJOLNIR)
  109.     {
  110.         if (self.walkframe >= 12)
  111.             self.walkframe = 0;
  112.       self.frame = 6 + self.walkframe;
  113.     }
  114. //hip
  115.     else
  116.     {
  117.         if (self.walkframe >= 5)
  118.             self.walkframe = 0;
  119.         self.frame = $stand1 + self.walkframe;
  120.     }
  121.     self.walkframe = self.walkframe + 1;    
  122. };
  123.  
  124. void()    player_run =[    $rockrun1,    player_run    ]
  125. {
  126.     self.weaponframe=0;
  127.     if (!self.velocity_x && !self.velocity_y)
  128.     {
  129.         self.walkframe=0;
  130.         player_stand1();
  131.         return;
  132.     }
  133.  
  134.     if (self.weapon == IT_AXE)
  135.     {
  136.         if (self.walkframe == 6)
  137.             self.walkframe = 0;
  138.         self.frame = $axrun1 + self.walkframe;
  139.     }
  140. //hip
  141.     else if (self.weapon == IT_MJOLNIR)
  142.     {
  143.       if (self.walkframe == 6)
  144.             self.walkframe = 0;
  145.       self.frame = self.walkframe;
  146.     }
  147. //hip
  148.     else
  149.     {
  150.         if (self.walkframe == 6)
  151.             self.walkframe = 0;
  152.         self.frame = self.frame + self.walkframe;
  153.     }
  154.  
  155. //hip
  156.  if (footsteps == 1)
  157.       {
  158.       self.spawnsilent = self.spawnsilent + vlen(self.origin - self.old_velocity);
  159.       self.old_velocity = self.origin;
  160.       if (self.flags & FL_ONGROUND)
  161.          {
  162.          if (self.spawnsilent > 95)
  163.             {
  164.             local float r;
  165.             if (self.spawnsilent > 190)
  166.                self.spawnsilent = 0;
  167.             else
  168.                {
  169.                self.spawnsilent = 0.5*(self.spawnsilent - 95);
  170.                }
  171.             r = random();
  172.             if (r < 0.14)
  173.                sound (self, CHAN_VOICE, "misc/foot1.wav", 0.5, ATTN_NORM);
  174.             else if (r < 0.29)
  175.                sound (self, CHAN_VOICE, "misc/foot2.wav", 0.5, ATTN_NORM);
  176.             else if (r < 0.43)
  177.                sound (self, CHAN_VOICE, "misc/foot3.wav", 0.5, ATTN_NORM);
  178.             else if (r < 0.58)
  179.                sound (self, CHAN_VOICE, "misc/foot4.wav", 0.5, ATTN_NORM);
  180.             else if (r < 0.72)
  181.                sound (self, CHAN_VOICE, "misc/foot5.wav", 0.5, ATTN_NORM);
  182.             else if (r < 0.86)
  183.                sound (self, CHAN_VOICE, "misc/foot6.wav", 0.5, ATTN_NORM);
  184.             else
  185.                sound (self, CHAN_VOICE, "misc/foot7.wav", 0.5, ATTN_NORM);
  186.             }
  187.          }
  188.       }
  189. //hip
  190.     self.walkframe = self.walkframe + 1;
  191. };
  192.  
  193. void()muzzleflash =
  194. {
  195.     WriteByte (MSG_BROADCAST, SVC_MUZZLEFLASH);
  196.     WriteEntity (MSG_BROADCAST, self);
  197. };
  198.  
  199.  
  200. void()    player_shot1 =    [$shotatt1, player_shot2    ] {self.weaponframe=1;muzzleflash();};
  201. void()    player_shot2 =    [$shotatt2, player_shot3    ] {self.weaponframe=2;};
  202. void()    player_shot3 =    [$shotatt3, player_shot4    ] {self.weaponframe=3;};
  203. void()    player_shot4 =    [$shotatt4, player_shot5    ] {self.weaponframe=4;};
  204. void()    player_shot5 =    [$shotatt5, player_shot6    ] {self.weaponframe=5;};
  205. void()    player_shot6 =    [$shotatt6, player_run    ] {self.weaponframe=6;};
  206.  
  207. void()    player_axe1 =    [$axatt1, player_axe2    ] {self.weaponframe=1;};
  208. void()    player_axe2 =    [$axatt2, player_axe3    ] {self.weaponframe=2;};
  209. void()    player_axe3 =    [$axatt3, player_axe4    ] {self.weaponframe=3;W_FireAxe();};
  210. void()    player_axe4 =    [$axatt4, player_run    ] {self.weaponframe=4;};
  211.  
  212. void()    player_axeb1 =    [$axattb1, player_axeb2    ] {self.weaponframe=5;};
  213. void()    player_axeb2 =    [$axattb2, player_axeb3    ] {self.weaponframe=6;};
  214. void()    player_axeb3 =    [$axattb3, player_axeb4    ] {self.weaponframe=7;W_FireAxe();};
  215. void()    player_axeb4 =    [$axattb4, player_run    ] {self.weaponframe=8;};
  216.  
  217. void()    player_axec1 =    [$axattc1, player_axec2    ] {self.weaponframe=1;};
  218. void()    player_axec2 =    [$axattc2, player_axec3    ] {self.weaponframe=2;};
  219. void()    player_axec3 =    [$axattc3, player_axec4    ] {self.weaponframe=3;W_FireAxe();};
  220. void()    player_axec4 =    [$axattc4, player_run    ] {self.weaponframe=4;};
  221.  
  222. void()    player_axed1 =    [$axattd1, player_axed2    ] {self.weaponframe=5;};
  223. void()    player_axed2 =    [$axattd2, player_axed3    ] {self.weaponframe=6;};
  224. void()    player_axed3 =    [$axattd3, player_axed4    ] {self.weaponframe=7;W_FireAxe();};
  225. void()    player_axed4 =    [$axattd4, player_run    ] {self.weaponframe=8;};
  226.  
  227.  
  228. //============================================================================
  229.  
  230. void() player_nail1   =[$nailatt1, player_nail2  ] 
  231. {
  232.     muzzleflash();
  233.  
  234.     if (!self.button0 || intermission_running)
  235.         {player_run ();return;}
  236.     self.weaponframe = self.weaponframe + 1;
  237.     if (self.weaponframe == 9)
  238.         self.weaponframe = 1;
  239.     SuperDamageSound();
  240.     W_FireSpikes (4);
  241.     self.attack_finished = time + 0.2;
  242. };
  243. void() player_nail2   =[$nailatt2, player_nail1  ]
  244. {
  245.     muzzleflash();
  246.  
  247.     if (!self.button0 || intermission_running)
  248.         {player_run ();return;}
  249.     self.weaponframe = self.weaponframe + 1;
  250.     if (self.weaponframe == 9)
  251.         self.weaponframe = 1;
  252.     SuperDamageSound();
  253.     W_FireSpikes (-4);
  254.     self.attack_finished = time + 0.2;
  255. };
  256.  
  257. //============================================================================
  258.  
  259. void() player_light1   =[$light1, player_light2  ] 
  260. {
  261.     muzzleflash();
  262.  
  263.     if (!self.button0 || intermission_running)
  264.         {player_run ();return;}
  265.     self.weaponframe = self.weaponframe + 1;
  266.     if (self.weaponframe == 5)
  267.         self.weaponframe = 1;
  268.     SuperDamageSound();
  269.     W_FireLightning();
  270.     self.attack_finished = time + 0.2;
  271. };
  272. void() player_light2   =[$light2, player_light1  ]
  273. {
  274.     muzzleflash();
  275.  
  276.     if (!self.button0 || intermission_running)
  277.         {player_run ();return;}
  278.     self.weaponframe = self.weaponframe + 1;
  279.     if (self.weaponframe == 5)
  280.         self.weaponframe = 1;
  281.     SuperDamageSound();
  282.     W_FireLightning();
  283.     self.attack_finished = time + 0.2;
  284. };
  285.  
  286. //============================================================================
  287.  
  288. //hip
  289.  
  290. //MED 10/18/96 added HIPWEAPONS
  291. //============================================================================
  292.  
  293. void()   player_hammer1 =  [32, player_hammer2   ] {self.weaponframe=1;};
  294. void()   player_hammer2 =  [33, player_hammer3   ] {self.weaponframe=2;};
  295. void()   player_hammer3 =  [34, player_hammer4   ] {self.weaponframe=3;};
  296. void()   player_hammer4 =  [35, player_hammer5   ] {self.weaponframe=4;HIP_FireMjolnir();};
  297. void()   player_hammer5 =  [36, player_hammer6   ] {self.weaponframe=4;};
  298. void()   player_hammer6 =  [37, player_run ] {self.weaponframe=4;};
  299.  
  300. void()   player_mjolnir1 =  [38, player_mjolnir2   ] {self.weaponframe=1;};
  301. void()   player_mjolnir2 =  [39, player_mjolnir3   ] {self.weaponframe=2;};
  302. void()   player_mjolnir3 =  [40, player_mjolnir4   ] {self.weaponframe=3;};
  303. void()   player_mjolnir4 =  [41, player_mjolnir5   ] {self.weaponframe=4;HIP_FireMjolnir();};
  304. void()   player_mjolnir5 =  [42, player_mjolnir6   ] {self.weaponframe=4;};
  305. void()   player_mjolnir6 =  [43, player_run ] {self.weaponframe=4;};
  306.  
  307. //============================================================================
  308.  
  309. //MED 10/18/96 added HIPSWEAPONS
  310. //void() player_laser1   =[$nailatt1, player_laser2  ] {self.attack_finished = time + 0.1;self.weaponframe=1;self.nextthink = time + 0.09;HIP_FireLaser(0);};
  311. //void() player_laser2   =[$nailatt2, player_laser4  ] {self.attack_finished = time + 0.1;self.weaponframe=2;self.nextthink = time + 0.09;};
  312. //void() player_laser3   =[$nailatt1, player_laser4  ] {self.attack_finished = time + 0.1;self.weaponframe=3;self.nextthink = time + 0.09;};
  313. //void() player_laser4   =[$nailatt2, player_laser5  ] {self.attack_finished = time + 0.1;self.weaponframe=4;self.nextthink = time + 0.09;HIP_FireLaser(1);};
  314. //void() player_laser5   =[$nailatt1, player_laser1  ] {self.attack_finished = time + 0.1;self.weaponframe=5;self.nextthink = time + 0.09;};
  315. //void() player_laser6   =[$nailatt2, player_laser1  ] {self.attack_finished = time + 0.1;self.weaponframe=6;self.nextthink = time + 0.09;};
  316. void() player_laser1   =[$nailatt1, player_laser3  ] {self.attack_finished = time + 0.1;self.weaponframe=1;self.nextthink = time + 0.1;HIP_FireLaser(0);};
  317. void() player_laser2   =[$nailatt2, player_laser3  ] {self.attack_finished = time + 0.1;self.weaponframe=2;self.nextthink = time + 0.1;};
  318. void() player_laser3   =[$nailatt2, player_laser1  ] {self.attack_finished = time + 0.1;self.weaponframe=4;self.nextthink = time + 0.1;HIP_FireLaser(1);};
  319. void() player_laser4   =[$nailatt1, player_laser1  ] {self.attack_finished = time + 0.1;self.weaponframe=5;self.nextthink = time + 0.1;};
  320. //============================================================================
  321.  
  322. //hip
  323.  
  324. void() player_rocket1   =[$rockatt1, player_rocket2  ] {self.weaponframe=1;
  325.     muzzleflash();};
  326. void() player_rocket2   =[$rockatt2, player_rocket3  ] {self.weaponframe=2;};
  327. void() player_rocket3   =[$rockatt3, player_rocket4  ] {self.weaponframe=3;};
  328. void() player_rocket4   =[$rockatt4, player_rocket5  ] {self.weaponframe=4;};
  329. void() player_rocket5   =[$rockatt5, player_rocket6  ] {self.weaponframe=5;};
  330. void() player_rocket6   =[$rockatt6, player_run  ] {self.weaponframe=6;};
  331. void(float num_bubbles) DeathBubbles;
  332.  
  333. void() PainSound =
  334. {
  335. local float        rs;
  336.  
  337.     if (self.health < 0)
  338.         return;
  339.  
  340.     if (damage_attacker.classname == "teledeath")
  341.     {
  342.         sound (self, CHAN_VOICE, "player/teledth1.wav", 1, ATTN_NONE);
  343.         return;
  344.     }
  345.  
  346. // water pain sounds
  347.     if (self.watertype == CONTENT_WATER && self.waterlevel == 3)
  348.     {
  349.         DeathBubbles(1);
  350.         if (random() > 0.5)
  351.             sound (self, CHAN_VOICE, "player/drown1.wav", 1, ATTN_NORM);
  352.         else
  353.             sound (self, CHAN_VOICE, "player/drown2.wav", 1, ATTN_NORM);
  354.         return;
  355.     }
  356.  
  357. // slime pain sounds
  358.     if (self.watertype == CONTENT_SLIME)
  359.     {
  360. // FIX ME    put in some steam here
  361.         if (random() > 0.5)
  362.             sound (self, CHAN_VOICE, "player/lburn1.wav", 1, ATTN_NORM);
  363.         else
  364.             sound (self, CHAN_VOICE, "player/lburn2.wav", 1, ATTN_NORM);
  365.         return;
  366.     }
  367.  
  368.     if (self.watertype == CONTENT_LAVA)
  369.     {
  370.         if (random() > 0.5)
  371.             sound (self, CHAN_VOICE, "player/lburn1.wav", 1, ATTN_NORM);
  372.         else
  373.             sound (self, CHAN_VOICE, "player/lburn2.wav", 1, ATTN_NORM);
  374.         return;
  375.     }
  376.  
  377.     if (self.pain_finished > time)
  378.     {
  379.         self.axhitme = 0;
  380.         return;
  381.     }
  382.     self.pain_finished = time + 0.5;
  383.  
  384. // don't make multiple pain sounds right after each other
  385.  
  386. // ax pain sound
  387.     if (self.axhitme == 1)
  388.     {
  389.         self.axhitme = 0;
  390.         sound (self, CHAN_VOICE, "player/axhit1.wav", 1, ATTN_NORM);
  391.         return;
  392.     }
  393.     
  394.  
  395.     rs = rint((random() * 5) + 1);
  396.  
  397.     self.noise = "";
  398.     if (rs == 1)
  399.         self.noise = "player/pain1.wav";
  400.     else if (rs == 2)
  401.         self.noise = "player/pain2.wav";
  402.     else if (rs == 3)
  403.         self.noise = "player/pain3.wav";
  404.     else if (rs == 4)
  405.         self.noise = "player/pain4.wav";
  406.     else if (rs == 5)
  407.         self.noise = "player/pain5.wav";
  408.     else
  409.         self.noise = "player/pain6.wav";
  410.  
  411.     sound (self, CHAN_VOICE, self.noise, 1, ATTN_NORM);
  412.     return;
  413. };
  414.  
  415. void()    player_pain1 =    [    $pain1,    player_pain2    ] {PainSound();self.weaponframe=0;};
  416. void()    player_pain2 =    [    $pain2,    player_pain3    ] {};
  417. void()    player_pain3 =    [    $pain3,    player_pain4    ] {};
  418. void()    player_pain4 =    [    $pain4,    player_pain5    ] {};
  419. void()    player_pain5 =    [    $pain5,    player_pain6    ] {};
  420. void()    player_pain6 =    [    $pain6,    player_run    ] {};
  421.  
  422. void()    player_axpain1 =    [    $axpain1,    player_axpain2    ] {PainSound();self.weaponframe=0;};
  423. void()    player_axpain2 =    [    $axpain2,    player_axpain3    ] {};
  424. void()    player_axpain3 =    [    $axpain3,    player_axpain4    ] {};
  425. void()    player_axpain4 =    [    $axpain4,    player_axpain5    ] {};
  426. void()    player_axpain5 =    [    $axpain5,    player_axpain6    ] {};
  427. void()    player_axpain6 =    [    $axpain6,    player_run    ] {};
  428.  
  429. //hip
  430. void()   player_hampain1 =  [  18,   player_hampain2 ] {PainSound();self.weaponframe=0;};
  431. void()   player_hampain2 =  [  19,   player_hampain3 ] {};
  432. void()   player_hampain3 =  [  20,   player_hampain4 ] {};
  433. void()   player_hampain4 =  [  21,   player_hampain5 ] {};
  434. void()   player_hampain5 =  [  22,   player_hampain6 ] {};
  435. void()   player_hampain6 =  [  23,   player_run  ] {};
  436. //hip
  437.  
  438. void() player_pain =
  439. {
  440.     if (self.weaponframe)
  441.         return;
  442.  
  443.     if (self.invisible_finished > time)
  444.         return;        // eyes don't have pain frames
  445.  
  446.     if (self.weapon == IT_AXE)
  447.         player_axpain1 ();
  448. //hip
  449.     else if (self.weapon == IT_MJOLNIR)
  450.           player_hampain1 ();
  451. //hip
  452.     else
  453.         player_pain1 ();
  454. };
  455.  
  456. void() player_diea1;
  457. void() player_dieb1;
  458. void() player_diec1;
  459. void() player_died1;
  460. void() player_diee1;
  461. void() player_die_ax1;
  462. //hip
  463. void() player_die_ham1;
  464. //hip
  465.  
  466. void() DeathBubblesSpawn =
  467. {
  468. local entity    bubble;
  469.     if (self.owner.waterlevel != 3)
  470.         return;
  471.     bubble = spawn();
  472.     setmodel (bubble, "progs/s_bubble.spr");
  473.     setorigin (bubble, self.owner.origin + '0 0 24');
  474.     bubble.movetype = MOVETYPE_NOCLIP;
  475.     bubble.solid = SOLID_NOT;
  476.     bubble.velocity = '0 0 15';
  477.     bubble.nextthink = time + 0.5;
  478.     bubble.think = bubble_bob;
  479.     bubble.classname = "bubble";
  480.     bubble.frame = 0;
  481.     bubble.cnt = 0;
  482.     setsize (bubble, '-8 -8 -8', '8 8 8');
  483.     self.nextthink = time + 0.1;
  484.     self.think = DeathBubblesSpawn;
  485.     self.air_finished = self.air_finished + 1;
  486.     if (self.air_finished >= self.bubble_count)
  487.         remove(self);
  488. };
  489.  
  490. void(float num_bubbles) DeathBubbles =
  491. {
  492. local entity    bubble_spawner;
  493.     
  494.     bubble_spawner = spawn();
  495.     setorigin (bubble_spawner, self.origin);
  496.     bubble_spawner.movetype = MOVETYPE_NONE;
  497.     bubble_spawner.solid = SOLID_NOT;
  498.     bubble_spawner.nextthink = time + 0.1;
  499.     bubble_spawner.think = DeathBubblesSpawn;
  500.     bubble_spawner.air_finished = 0;
  501.     bubble_spawner.owner = self;
  502.     bubble_spawner.bubble_count = num_bubbles;
  503.     return;
  504. };
  505.  
  506.  
  507. void() DeathSound =
  508. {
  509. local float        rs;
  510.  
  511.     // water death sounds
  512.     if (self.waterlevel == 3)
  513.     {
  514.         DeathBubbles(20);
  515.         sound (self, CHAN_VOICE, "player/h2odeath.wav", 1, ATTN_NONE);
  516.         return;
  517.     }
  518.     
  519.     rs = rint ((random() * 4) + 1);
  520.     if (rs == 1)
  521.         self.noise = "player/death1.wav";
  522.     if (rs == 2)
  523.         self.noise = "player/death2.wav";
  524.     if (rs == 3)
  525.         self.noise = "player/death3.wav";
  526.     if (rs == 4)
  527.         self.noise = "player/death4.wav";
  528.     if (rs == 5)
  529.         self.noise = "player/death5.wav";
  530.  
  531.     sound (self, CHAN_VOICE, self.noise, 1, ATTN_NONE);
  532.     return;
  533. };
  534.  
  535.  
  536. void() PlayerDead =
  537. {
  538.     self.nextthink = -1;
  539. // allow respawn after a certain time
  540.     self.deadflag = DEAD_DEAD;
  541. };
  542.  
  543. vector(float dm) VelocityForDamage =
  544. {
  545.     local vector v;
  546.  
  547. //hip
  548. //MED 01/17/97
  549.    if (vlen(damage_inflictor.velocity)>0)
  550.       {
  551.       v = 0.2 * damage_inflictor.velocity;
  552.       v = v + (25 * normalize(self.origin-damage_inflictor.origin));
  553.       v_z = 100 + 100 * random();
  554.       v_x = v_x + (50 * crandom());
  555.       v_y = v_y + (50 * crandom());
  556.       }
  557.    else
  558.       {
  559.       v_x = 100 * crandom();
  560.       v_y = 100 * crandom();
  561.       v_z = 200 + 100 * random();
  562.       }
  563.    if (dm > -50)
  564.    {
  565. //    dprint ("level 1\n");
  566.       v = v * 0.7;
  567.    }
  568.    else if (dm > -200)
  569.    {
  570. //    dprint ("level 3\n");
  571.       v = v * 2;
  572.    }
  573.    else
  574.       v = v * 10;
  575.    return v;
  576. //hip
  577. };
  578.  
  579. void(string gibname, float dm) ThrowGib =
  580. {
  581.     local    entity new;
  582.  
  583.     new = spawn();
  584.     new.origin = self.origin;
  585.     setmodel (new, gibname);
  586.     setsize (new, '0 0 0', '0 0 0');
  587.     new.velocity = VelocityForDamage (dm);
  588.     new.movetype = MOVETYPE_BOUNCE;
  589.     new.solid = SOLID_NOT;
  590.     new.avelocity_x = random()*600;
  591.     new.avelocity_y = random()*600;
  592.     new.avelocity_z = random()*600;
  593.     new.think = SUB_Remove;
  594.     new.ltime = time;
  595.     new.nextthink = time + 10 + random()*10;
  596.     new.frame = 0;
  597.     new.flags = 0;
  598. };
  599.  
  600. //hip
  601. //MED
  602. void() HeadThink =
  603.    {
  604.    self.nextthink = -1;
  605.    if (world.worldtype != 2)
  606.       {
  607.       if (random()<0.1)
  608.          sound (self, 6, "misc/flys.wav", 0.7, ATTN_STATIC);
  609.       }
  610.    };
  611. //hip
  612.  
  613. void(string gibname, float dm) ThrowHead =
  614. {
  615.     setmodel (self, gibname);
  616.     self.frame = 0;
  617. //hip
  618. //   self.nextthink = -1;
  619. //MED
  620.    self.nextthink = time + 1.5;
  621. //hip
  622.     self.movetype = MOVETYPE_BOUNCE;
  623.     self.takedamage = DAMAGE_NO;
  624.     self.solid = SOLID_NOT;
  625.     self.view_ofs = '0 0 8';
  626.     setsize (self, '-16 -16 0', '16 16 56');
  627.     self.velocity = VelocityForDamage (dm);
  628.     self.origin_z = self.origin_z - 24;
  629.     self.flags = self.flags - (self.flags & FL_ONGROUND);
  630.     self.avelocity = crandom() * '0 600 0';
  631. //hip
  632. //MED
  633.    self.gorging = TRUE;
  634.    self.think = HeadThink;
  635. //hip
  636. };
  637.  
  638.  
  639. void() GibPlayer =
  640. {
  641.     ThrowHead ("progs/h_player.mdl", self.health);
  642.     ThrowGib ("progs/gib1.mdl", self.health);
  643.     ThrowGib ("progs/gib2.mdl", self.health);
  644.     ThrowGib ("progs/gib3.mdl", self.health);
  645.  
  646.     self.deadflag = DEAD_DEAD;
  647.  
  648.     if (damage_attacker.classname == "teledeath")
  649.     {
  650.         sound (self, CHAN_VOICE, "player/teledth1.wav", 1, ATTN_NONE);
  651.         return;
  652.     }
  653.  
  654.     if (damage_attacker.classname == "teledeath2")
  655.     {
  656.         sound (self, CHAN_VOICE, "player/teledth1.wav", 1, ATTN_NONE);
  657.         return;
  658.     }
  659.         
  660.     if (random() < 0.5)
  661.         sound (self, CHAN_VOICE, "player/gib.wav", 1, ATTN_NONE);
  662.     else
  663.         sound (self, CHAN_VOICE, "player/udeath.wav", 1, ATTN_NONE);
  664. };
  665.  
  666. void() PlayerDie =
  667. {
  668.     local    float    i;
  669.     
  670.     self.items = self.items - (self.items & IT_INVISIBILITY);
  671.     self.invisible_finished = 0;    // don't die as eyes
  672.     self.invincible_finished = 0;
  673.     self.super_damage_finished = 0;
  674.     self.radsuit_finished = 0;
  675. //hip
  676.     //JIM
  677.     self.wetsuit_finished = 0;
  678. //hip
  679.    self.modelindex = modelindex_player;   // don't use eyes
  680. //hip
  681.    //JIM
  682.    self.empathy_finished = 0;
  683.    self.items2 = self.items2 - (self.items2 & HIP_IT_EMPATHY_SHIELDS);
  684. //hip
  685.  
  686.     DropBackpack();
  687.     
  688.     self.weaponmodel="";
  689.     self.view_ofs = '0 0 -8';
  690.     self.deadflag = DEAD_DYING;
  691.     self.solid = SOLID_NOT;
  692.     self.flags = self.flags - (self.flags & FL_ONGROUND);
  693.     self.movetype = MOVETYPE_TOSS;
  694.     if (self.velocity_z < 10)
  695.         self.velocity_z = self.velocity_z + random()*300;
  696.  
  697.     if (self.health < -40)
  698.     {
  699.         GibPlayer ();
  700.         return;
  701.     }
  702.  
  703.     DeathSound();
  704.     
  705.     self.angles_x = 0;
  706.     self.angles_z = 0;
  707.     
  708.     if (self.weapon == IT_AXE)
  709.     {
  710.         player_die_ax1 ();
  711.         return;
  712.     }
  713.     
  714. //hip
  715.    //MED 12/04/96
  716.    else if (self.weapon == IT_MJOLNIR)
  717.       {
  718.       self.modelindex = modelindex_hammer; // use hammer model
  719.       player_die_ham1();
  720.       return;
  721.       }
  722. //hip
  723.  
  724.     i = cvar("temp1");
  725.     if (!i)
  726.         i = 1 + floor(random()*6);
  727.     
  728.     if (i == 1)
  729.         player_diea1();
  730.     else if (i == 2)
  731.         player_dieb1();
  732.     else if (i == 3)
  733.         player_diec1();
  734.     else if (i == 4)
  735.         player_died1();
  736.     else
  737.         player_diee1();
  738.  
  739. };
  740.  
  741. void() set_suicide_frame =
  742. {    // used by klill command and diconnect command
  743.     if (self.model != "progs/player.mdl")
  744.         return;    // allready gibbed
  745.     self.frame = $deatha11;
  746.     self.solid = SOLID_NOT;
  747.     self.movetype = MOVETYPE_TOSS;
  748.     self.deadflag = DEAD_DEAD;
  749.     self.nextthink = -1;
  750. };
  751.  
  752.  
  753. void()    player_diea1    =    [    $deatha1,    player_diea2    ] {};
  754. void()    player_diea2    =    [    $deatha2,    player_diea3    ] {};
  755. void()    player_diea3    =    [    $deatha3,    player_diea4    ] {};
  756. void()    player_diea4    =    [    $deatha4,    player_diea5    ] {};
  757. void()    player_diea5    =    [    $deatha5,    player_diea6    ] {};
  758. void()    player_diea6    =    [    $deatha6,    player_diea7    ] {};
  759. void()    player_diea7    =    [    $deatha7,    player_diea8    ] {};
  760. void()    player_diea8    =    [    $deatha8,    player_diea9    ] {};
  761. void()    player_diea9    =    [    $deatha9,    player_diea10    ] {};
  762. void()    player_diea10    =    [    $deatha10,    player_diea11    ] {};
  763. void()    player_diea11    =    [    $deatha11,    player_diea11 ] {PlayerDead();};
  764.  
  765. void()    player_dieb1    =    [    $deathb1,    player_dieb2    ] {};
  766. void()    player_dieb2    =    [    $deathb2,    player_dieb3    ] {};
  767. void()    player_dieb3    =    [    $deathb3,    player_dieb4    ] {};
  768. void()    player_dieb4    =    [    $deathb4,    player_dieb5    ] {};
  769. void()    player_dieb5    =    [    $deathb5,    player_dieb6    ] {};
  770. void()    player_dieb6    =    [    $deathb6,    player_dieb7    ] {};
  771. void()    player_dieb7    =    [    $deathb7,    player_dieb8    ] {};
  772. void()    player_dieb8    =    [    $deathb8,    player_dieb9    ] {};
  773. void()    player_dieb9    =    [    $deathb9,    player_dieb9    ] {PlayerDead();};
  774.  
  775. void()    player_diec1    =    [    $deathc1,    player_diec2    ] {};
  776. void()    player_diec2    =    [    $deathc2,    player_diec3    ] {};
  777. void()    player_diec3    =    [    $deathc3,    player_diec4    ] {};
  778. void()    player_diec4    =    [    $deathc4,    player_diec5    ] {};
  779. void()    player_diec5    =    [    $deathc5,    player_diec6    ] {};
  780. void()    player_diec6    =    [    $deathc6,    player_diec7    ] {};
  781. void()    player_diec7    =    [    $deathc7,    player_diec8    ] {};
  782. void()    player_diec8    =    [    $deathc8,    player_diec9    ] {};
  783. void()    player_diec9    =    [    $deathc9,    player_diec10    ] {};
  784. void()    player_diec10    =    [    $deathc10,    player_diec11    ] {};
  785. void()    player_diec11    =    [    $deathc11,    player_diec12    ] {};
  786. void()    player_diec12    =    [    $deathc12,    player_diec13    ] {};
  787. void()    player_diec13    =    [    $deathc13,    player_diec14    ] {};
  788. void()    player_diec14    =    [    $deathc14,    player_diec15    ] {};
  789. void()    player_diec15    =    [    $deathc15,    player_diec15 ] {PlayerDead();};
  790.  
  791. void()    player_died1    =    [    $deathd1,    player_died2    ] {};
  792. void()    player_died2    =    [    $deathd2,    player_died3    ] {};
  793. void()    player_died3    =    [    $deathd3,    player_died4    ] {};
  794. void()    player_died4    =    [    $deathd4,    player_died5    ] {};
  795. void()    player_died5    =    [    $deathd5,    player_died6    ] {};
  796. void()    player_died6    =    [    $deathd6,    player_died7    ] {};
  797. void()    player_died7    =    [    $deathd7,    player_died8    ] {};
  798. void()    player_died8    =    [    $deathd8,    player_died9    ] {};
  799. void()    player_died9    =    [    $deathd9,    player_died9    ] {PlayerDead();};
  800.  
  801. void()    player_diee1    =    [    $deathe1,    player_diee2    ] {};
  802. void()    player_diee2    =    [    $deathe2,    player_diee3    ] {};
  803. void()    player_diee3    =    [    $deathe3,    player_diee4    ] {};
  804. void()    player_diee4    =    [    $deathe4,    player_diee5    ] {};
  805. void()    player_diee5    =    [    $deathe5,    player_diee6    ] {};
  806. void()    player_diee6    =    [    $deathe6,    player_diee7    ] {};
  807. void()    player_diee7    =    [    $deathe7,    player_diee8    ] {};
  808. void()    player_diee8    =    [    $deathe8,    player_diee9    ] {};
  809. void()    player_diee9    =    [    $deathe9,    player_diee9    ] {PlayerDead();};
  810.  
  811. void()    player_die_ax1    =    [    $axdeth1,    player_die_ax2    ] {};
  812. void()    player_die_ax2    =    [    $axdeth2,    player_die_ax3    ] {};
  813. void()    player_die_ax3    =    [    $axdeth3,    player_die_ax4    ] {};
  814. void()    player_die_ax4    =    [    $axdeth4,    player_die_ax5    ] {};
  815. void()    player_die_ax5    =    [    $axdeth5,    player_die_ax6    ] {};
  816. void()    player_die_ax6    =    [    $axdeth6,    player_die_ax7    ] {};
  817. void()    player_die_ax7    =    [    $axdeth7,    player_die_ax8    ] {};
  818. void()    player_die_ax8    =    [    $axdeth8,    player_die_ax9    ] {};
  819. void()    player_die_ax9    =    [    $axdeth9,    player_die_ax9    ] {PlayerDead();};
  820.  
  821. //hip
  822.  
  823. void()   player_die_ham1 =  [ 24 ,   player_die_ham2 ] {};
  824. void()   player_die_ham2 =  [ 25 ,   player_die_ham3 ] {};
  825. void()   player_die_ham3 =  [ 26 ,   player_die_ham4 ] {};
  826. void()   player_die_ham4 =  [ 27 ,   player_die_ham5 ] {};
  827. void()   player_die_ham5 =  [ 28 ,   player_die_ham6 ] {};
  828. void()   player_die_ham6 =  [ 29 ,   player_die_ham7 ] {};
  829. void()   player_die_ham7 =  [ 30 ,   player_die_ham8 ] {};
  830. void()   player_die_ham8 =  [ 31 ,   player_die_ham8 ] {PlayerDead();};
  831.  
  832. //hip
  833.